import 'package:json_annotation/json_annotation.dart';
import 'package:gzmall_app/model/order_item.dart';
import 'package:gzmall_app/model/user.dart';

part 'comment.g.dart';

@JsonSerializable()
class Comment extends Object {
  @JsonKey(name: 'id')
  int id;

  @JsonKey(name: 'content')
  String content;

  @JsonKey(name: 'review')
  String review;

  @JsonKey(name: 'hide_user')
  bool hideUser;

  @JsonKey(name: 'score')
  int score;

  @JsonKey(name: 'created_at')
  String createdAt;

  @JsonKey(name: 'created_time_at')
  String createdTimeAt;

  @JsonKey(name: 'order_item')
  OrderItem orderItem;

  @JsonKey(name: 'user')
  User user;

  Comment(
    this.id,
    this.content,
    this.review,
    this.hideUser,
    this.score,
    this.createdAt,
    this.createdTimeAt,
    this.orderItem,
    this.user,
  );

  factory Comment.fromJson(Map<String, dynamic> srcJson) =>
      _$CommentFromJson(srcJson);
}
